// 封装ios 安卓方法

let commin = {
  getPhoneWeb: getPhoneWeb,
  getLocationWeb: getLocationWeb
};
//控制开关，pc好调试
const state = true;

//获取手机 通讯录权限方法
function getPhoneWeb() {
  var handler = {
    callHander: function(json) {
      let userAgentObj = navigator.userAgent;
      if (userAgentObj.match(/iPhone/i)) {
        return window.webkit.messageHandlers.getPhone.postMessage(JSON.stringify(json));
      }
    }
  };
  let userAgentObj = navigator.userAgent;
  if (userAgentObj.match(/Android/i)) {
    return window.control.getPhone();
  } else if (userAgentObj.match(/iPhone/i)) {
    if (state) {
      return handler.callHander({ name: "XXX", mobile: "153XXXXX" });;
    }else{
      return '';
    }
  }
}
//坐标获取
function getLocationWeb() {
  let userAgentObj = navigator.userAgent;
  if (userAgentObj.match(/Android/i)) {
    return window.control.getLocation();
  } else if (userAgentObj.match(/iPhone/i)) {
    if (state) {
      return getLocation();
    } else {
      return "";
    }
  }
}

export default commin;


     //  deviceNo: deviceNo,
      // deviceType: Util.deviceType,
      // deviceInfo: PhoneVleus